var prefix = jsctx + "/tenant/user";

var modifyLogo = (function () {
    function init() {
        validateRule();
    };

    function save() {
        var formData = new FormData($("#frmLogo")[0]);
        $.ajax({
            cache: true,
            type: "POST",
            url: prefix + "/saveLogo",
            processData: false,   // jQuery不要去处理发送的数据
            contentType: false,   // jQuery不要去设置Content-Type请求头
            data: formData,
            async: false,
            error: function (request) {
                parent.layer.alert("Connection error");
            },
            success: function (data) {
                if (data.status == 200) {
                    parent.layer.msg("操作成功");
                    // window.location.reload();
                    parent.location.reload()
                } else {
                    parent.layer.alert(data.message)
                }
            }
        });
    };

    function validateRule() {
        var icon = "<i class='fa fa-times-circle'></i> ";
        $("#frmLogo").validate({
            rules: {

            },
            messages: {

            },
            submitHandler: function (form) {
                save();
            }
        })
    };

    function goBack() {
        location.href = jsctx + "/basic";
    }

    return {
        init: init,
        goBack: goBack
    };
})();